package cmpe.swe.purcom.dao.extractor;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import cmpe.swe.purcom.model.Stuff;

public class StuffResultSetExtractor implements ResultSetExtractor<Stuff> {

	@Override
	public Stuff extractData(ResultSet rs) throws SQLException,
			DataAccessException {
		Stuff s = new Stuff();
		s.setId(rs.getLong(1));
		s.setAmountRequested(rs.getInt(2));
		s.setName(rs.getString(3));
		s.setDescription(rs.getString(4));
		s.setLocation(rs.getString(5));
		s.setDatetime(rs.getTimestamp(6));
		s.setCommunityid(rs.getLong(7));
		s.setAmountContributed(rs.getInt(8));
		return s;
	}

}
